/*********************************************************************
 *
 *                          api请求接口
 *
 *********************************************************************/
'use strict';


import HttpRuqest from '@/router/axios.extend';

/** 
 *  根据地址和高度查询交易流水 
 *  _address:交易地址
 *  _height：高度
 */
export const getAccountTransactionsRequest = (_address:string, _height:number) => {
    
    console.log(`根据地址和高度查询交易流水:/v1.0.0/account/transactions?address=${_address}&height=${_height}`);
   
    return HttpRuqest.request({
        url: `/v1.0.0/account/transactions?address=${_address}&height=${_height}`,
        method: 'GET',
    });
};


/** 
 *  查交易详情的接口 
 *  _hash:哈希
 */
export const getAccountTransactionsDetailRequest = (_hash:string) => {
    
    console.log(`查交易详情的接口:/v1.0.0/block-by-hash?hash=${_hash}`);
   
    return HttpRuqest.request({
        url: `/v1.0.0/block-by-hash?hash=${_hash}`,
        method: 'GET',
    });
};


/** 
 * 获取MC主块信息列表的接口 
 */
export const getLatestMcBlockRequest = () => {
    
    console.log(`获取MC主块信息列表的接口:/v1.0.0/latest-mc-block`);
   
    return HttpRuqest.request({
        url: `/v1.0.0/latest-mc-block`,
        method: 'GET',
    });
};


/** 
 *  概览 
 */
export const globalInfoRequest = () => {
    
    console.log(`获取概览的接口:/v1.0.0/global-info`);
   
    return HttpRuqest.request({
        url: `/v1.0.0/global-info`,
        method: 'GET',
    });
};


/** 
 *  最近出块 
 *  _hash:哈希
 */
export const getLatestBlockRequest = (_hash:string) => {
    
    console.log(`获取最近出块的接口:/v1.0.0/latest-block?hash=${_hash}`);
   
    return HttpRuqest.request({
        url: `/v1.0.0/latest-block?hash=${_hash}`,
        method: 'GET',
    });
};


/** 
 *  节点分布 
 *  _hash:哈希
 */
export const getGlobalNodeDistInfoRequest = () => {
    
    console.log(`获取概览的接口:/v1.0.0/global-node-dist-info`);
   
    return HttpRuqest.request({
        url: `/v1.0.0/global-node-dist-info`,
        method: 'GET',
    });
};


/** 
 *  获取全网高度
 */
export const getLatestBlockHeightRequest = () => {
    
    console.log(`获取全网高度的接口:/v1.0.0/latest-block-height`);
   
    return HttpRuqest.request({
        url: `/v1.0.0/latest-block-height`,
        method: 'GET',
    });
};


